#【光】
execute unless entity @a[tag=BossAlready] as @a[tag=xingchen,scores={skGolden_shovel0=1..}] at @s run scoreboard players add @a[distance=0.1..5] xingchen5 5
execute if entity @a[tag=BossAlready] as @a[tag=xingchen,scores={skGolden_shovel0=1..}] at @s run scoreboard players add @a[team=King,distance=0.1..5] xingchen5 5
scoreboard players reset @a[tag=xingchen,scores={skGolden_shovel0=1..}] skGolden_shovel0

#【微光追随】
scoreboard players set @a[tag=xingchen,scores={skCrossBow1=1..}] skCDPearl 5
scoreboard players reset @a[tag=xingchen,scores={skCrossBow1=1..}] skCrossBow1

#【微光追随】改变箭
execute as @e[type=#arrows,nbt={PierceLevel:14b}] run data merge entity @s {damage:2.2,PierceLevel:0b,Tags:[weiguang]}

#【微光追随】持续加
execute unless entity @a[tag=BossAlready] at @e[type=#arrows,tag=weiguang] run scoreboard players add @a[tag=!xingchen,distance=0..6,gamemode=!spectator] xingchen5 1
execute if entity @a[tag=BossAlready] at @e[type=#arrows,tag=weiguang] run scoreboard players add @a[team=King,distance=0..6,gamemode=!spectator] xingchen5 1

#【微光追随】二段：落地
execute at @e[type=#arrows,tag=weiguang,nbt={inGround:1b}] at @a[distance=0..6,scores={xingchen5=1..},gamemode=!spectator] run summon minecraft:spectral_arrow ~ ~3 ~ {CustomName:'[{"text":"爆炸光箭","color":"yellow","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false}]',Motion:[0.0,-0.8,0.0],damage:6,Tags:["boomGoldArrow"]}
kill @e[type=#arrows,tag=weiguang,nbt={inGround:1b}]
#【微光追随】CD
give @a[tag=xingchen,scores={skCDPearl=0}] minecraft:crossbow{ChargedProjectiles:[{id:"minecraft:arrow",Count:1b,tag:{display:{Name:'[{"text":"微光箭","color":"aqua","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false}]'}}}],Charged:1b,Damage:465,display:{Name:'[{"text":"技能：微光追随","color":"aqua","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false}]',Lore:['{"text":"主动技能【微光追随】","color":"dark_purple","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false}','{"text":"箭飞行时持续对周围敌人增加[微光]","color":"gold","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false}','{"text":"微光箭落地时在周围6格范围内所有携带[微光]的","color":"gold","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false}','{"text":"玩家上方生成一支慢速[爆炸光箭]","color":"gold","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false}','{"text":"冷却时间 5s","color":"dark_red","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false}']},Enchantments:[{id:"minecraft:piercing",lvl:14}],HideFlags:1} 1
scoreboard players reset @a[tag=xingchen,scores={skCDPearl=0}] skCDPearl




#【星之陨落】
execute as @a[tag=xingchen,scores={skEXBottle=1..}] at @s rotated ~ 0 positioned ^ ^2 ^ run summon fireball ~ ~10 ~ {Motion:[0.0,-1.2,0.0],ExplosionPower:2}
execute as @a[tag=xingchen,scores={skEXBottle=1..}] run tellraw @a [{"selector":"@s","color":"gold","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false},{"text":"：释放技能","color":"blue","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false},{"text":"【星之陨落】","color":"dark_red","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false},{"text":"—氐","color":"gold","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false}]
scoreboard players set @a[tag=xingchen,scores={skEXBottle=1..}] skCDEXBottle 8
scoreboard players reset @a[tag=xingchen,scores={skEXBottle=1..}] skEXBottle

# 被动技能【遇】[爆破光箭]
execute at @a[scores={xingchen5=12..}] at @e[type=snowball,tag=!GoldArrow,distance=0..8] at @a[scores={xingchen5=4..},distance=0..20,gamemode=!spectator] positioned ~ ~4 ~ run summon minecraft:spectral_arrow ~ ~3 ~ {CustomName:'[{"text":"爆炸光箭","color":"yellow","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false}]',Motion:[0.0,-1.3,0.0],damage:7,Tags:["boomGoldArrow"]}
execute at @a[scores={xingchen5=12..}] run kill @e[type=snowball,tag=!GoldArrow,distance=0..8] 

execute at @a[scores={xingchen5=12..}] at @e[type=fireball,distance=0..8] at @a[scores={xingchen5=4..},distance=0..20,gamemode=!spectator] positioned ~ ~4 ~ run summon minecraft:spectral_arrow ~ ~3 ~ {CustomName:'[{"text":"爆炸光箭","color":"yellow","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false}]',Motion:[0.0,-1.3,0.0],damage:7,Tags:["boomGoldArrow"]}
execute at @a[scores={xingchen5=12..}] run kill @e[type=fireball,distance=0..8] 

execute at @e[type=spectral_arrow,tag=boomGoldArrow,nbt={inGround:1b}] run summon minecraft:slime ~ ~0.5 ~ {CustomName:'[{"text":" 爆破光箭 ","color":"yellow","bold":true,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false}]',ActiveEffects:[{Id:14,Amplifier:0,Duration:600,ShowParticles:0b}],Silent:1b,Size:5,wasOnGround:1b,Attributes:[{Name:"generic.attack_damage",Base:4}]}
execute at @e[type=spectral_arrow,tag=boomGoldArrow,nbt={inGround:1b}] run particle minecraft:explosion ~ ~ ~ 0.7 1 0.7 1 7
execute at @e[type=spectral_arrow,tag=boomGoldArrow,nbt={inGround:1b}] run playsound minecraft:entity.generic.explode player @a ~ ~ ~ 3 0.7
execute at @e[type=spectral_arrow,tag=boomGoldArrow,nbt={inGround:1b}] run particle minecraft:lava ~ ~ ~ 1.5 2.5 1.5 0.1 15 normal @a
execute at @e[type=spectral_arrow,tag=boomGoldArrow,nbt={inGround:1b}] run particle minecraft:smoke ~ ~ ~ 0.1 1 0.1 0.1 50 normal @a
execute at @e[type=spectral_arrow,tag=boomGoldArrow,nbt={inGround:1b}] run particle minecraft:flame ~ ~ ~ 0.2 0.3 0.2 0.01 10 normal @a
kill @e[type=spectral_arrow,tag=boomGoldArrow,nbt={inGround:1b}]


# [微光]
# 携带[微光]印记的玩家固有 缓慢I
effect give @a[scores={xingchen5=1..}] slowness 1 0 true
# 达到10层时提升为 缓慢II
effect give @a[scores={xingchen5=10..}] slowness 1 1 true
# 达到15层时提升为 缓慢III 额外附加发光I
effect give @a[scores={xingchen5=15..}] slowness 1 2 true
effect give @a[scores={xingchen5=15..}] glowing 1 0 true
# 高于20层时受到 禁锢1s 发光 5s 并立即回到14层
scoreboard players set @a[scores={xingchen5=21..}] EFLock 20
effect give @a[scores={xingchen5=21..}] glowing 5 0 true
scoreboard players set @a[scores={xingchen5=21..}] xingchen5 14




#【星之陨落】CD
give @a[tag=xingchen,scores={skCDEXBottle=0}] minecraft:experience_bottle{display:{Name:'[{"text":"技能：星辰陨落","color":"gold","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false}]',Lore:['{"text":"主动技能【星辰陨落】","color":"dark_purple","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false}','{"text":"在自身上方生成一颗","color":"gold","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false}','{"text":"快速下降的强力火焰弹","color":"gold","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false}','{"text":"冷却时间：8s","color":"dark_red","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false}']},Enchantments:[{id:"minecraft:loyalty",lvl:10}]} 1
scoreboard players reset @a[tag=xingchen,scores={skCDEXBottle=0}] skCDEXBottle





execute as @a at @p[tag=xingchen] run title @p actionbar [{"text":"微光追随","color":"dark_red","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false},{"text":"正在冷却 ","color":"gold","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false},{"score":{"objective":"skCDPearl","name":"@p"},"color":"aqua","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false},{"text":"s","color":"gold","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false},{"text":" 星之陨落 ","color":"dark_red","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false},{"text":"正在冷却：","color":"gold","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false},{"score":{"objective":"skCDEXBottle","name":"@p"},"color":"aqua","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false},{"text":"s","color":"gold","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false},{"text":" 附近玩家的[微光]层数","color":"gold","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false},{"score":{"objective":"xingchen5","name":"@s"},"color":"aqua","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false}]
